package com.jingfang.cloud.constant.ui;

import cn.hutool.core.img.ImgUtil;
import com.formdev.flatlaf.extras.FlatSVGIcon;
import com.formdev.flatlaf.extras.FlatSVGUtils;

import javax.swing.*;
import java.awt.*;
import java.net.URL;
import java.util.List;

public class Resources {

    public static List<Image> MZ_WINDOW_ICONS = FlatSVGUtils.createWindowIconImages("/svg/logo.svg");
    public static final Icon EXECUTE_ICON = new FlatSVGIcon("svg/actions/execute.svg",128,128);
    public static final Icon PAUSE_ICON = new FlatSVGIcon("svg/actions/suspend.svg",128,128);
    public static final Icon CONNECT_SUCCESS_ICON = new FlatSVGIcon("svg/status_ok.svg",16,16);
    public static final Icon CONNECT_ERROR_ICON = new FlatSVGIcon("svg/status_error.svg",16,16);

    public static URL getImageUrl(String path) {
        return Resources.class.getClassLoader().getResource(path);
    }

    public static Image getImage(String path) {
        URL imageUrl = getImageUrl(path);
        return ImgUtil.getImage(imageUrl);
    }
}
